package com.mohan.aop.impl;

import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class WindowsCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        final ClassLoader classLoader = context.getClassLoader();
        final Environment environment = context.getEnvironment();
        final BeanDefinitionRegistry registry = context.getRegistry();

        final String property = environment.getProperty("os.name");
        if (property.contains("Windows")) return true;
        return false;
    }
}
